home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Development Platforms / LISP Related / LISP Goodies / AV Parser / Sample Grammars / 00 Context-free Grammar.Lisp next >
Encoding:
Text File  |  1992-09-02  |  854 b   |  25 lines  |  [TEXT/CCL2]

  1. ;;; 00 Context-free Grammar.Lisp
  2. ;;;
  3. ;;; A grammar that generates one string, viz. "Uther sleeps".
  4. ;;; Based on Shieber's example in Chapter, Section 3, pp. 21-22.
  5. ;;; It also generates two other strings (what are they?).
  6. ;;;
  7. ;;; The parser ignores anything following a semi-colon to the end of a line,
  8. ;;; so anything following a semi-colon is a comment to you, dear reader!
  9. ;;;
  10. ;;; Read this grammar into the parser by choosing "Eval Buffer" from the
  11. ;;; "Eval" menu.  Then enter "(p uther sleeps)" in the Listener (and press
  12. ;;; Return) to parse the utterance "Uther sleeps".  You should see a
  13. ;;; Tree Window displaying a parse tree, and an Avm Window displaying the
  14. ;;; the features associated with the top node in that tree.
  15.  
  16.  
  17. #[     ; this tells Lisp to beging reading a grammar.
  18.  
  19. s --> np vp :.
  20.  
  21. uther  np:.
  22. sleeps vp:.
  23.  
  24. #]   ; end of grammar.
  25.